package com.ehotting.edsta.diagnosisPredict.feign.factory;

import com.ehotting.eaf.core.web.domain.diagnosisPredict.Response;
import com.ehotting.edsta.diagnosisPredict.domain.dto.TrainingInfoDto;
import com.ehotting.edsta.diagnosisPredict.feign.TraininginfoFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 模型任务训练的降级处理
 * 
 * @author edsta
 */
@Slf4j
@Component
public class TraininginfoFallbackFactory implements FallbackFactory<TraininginfoFeignService> {

    @Override
    public TraininginfoFeignService create(Throwable throwable)
    {
        log.error("模型任务训练调用失败:{}", throwable.getMessage());
        return new TraininginfoFeignService() {
            @Override
            public Response<TrainingInfoDto> trainingInfoCreate(TrainingInfoDto dto) {
                return null;
            }

            @Override
            public Response<Boolean> startTask(Long id) {
                return null;
            }

            @Override
            public Response<TrainingInfoDto> getByProjectId(Long projectId) {
                return null;
            }
        };
    }
}
